package com.example.yyy

import android.content.Context
import android.util.AttributeSet
import android.widget.ListView

class NoScrollListView @JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null, defStyle: Int = 0)
    : ListView(context,attrs,defStyle){
    //将高度设置为最大值
    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        //shr == >>
        val expandSpec = MeasureSpec.makeMeasureSpec(Int.MAX_VALUE shr 2, MeasureSpec.AT_MOST)
        super.onMeasure(widthMeasureSpec, expandSpec)
    }
}